//
//  Test2ViewController.m
//  Oc_Ui_Noob_XZL_Locke
//
//  Created by 江山 on 15/11/18.
//  Copyright © 2015年 hi. All rights reserved.
//

#import "Test2ViewController.h"
//导入协议
@interface Test2ViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation Test2ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //定义tableview(大小位置与风格)
    self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    //遵循协议
    self.tableview.dataSource = self;
    self.tableview.delegate = self;
    [self.view addSubview:self.tableview];
    //注册类（回收内存）
    [self.tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"abcde"];

    self.title = @"Hi";
}

//返回行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

//显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"abcde"];
    cell.textLabel.text =@"123";
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
